import os
import sys
HOME_PATH = os.path.join(
    os.path.dirname(os.path.dirname(os.path.abspath(__file__))),
    'src/')
sys.path.append(HOME_PATH)
from rabbitmqpy import Subscriber


import json
# 测试
amqp_url = 'amqp://10.12.3.162:31911'
# amqp_url = 'amqp://10.12.3.162:32037'

class Test(Subscriber):

    def __init__(self):
        Subscriber.__init__(
            self,
            amqp_url,
            'shuiqing_test',
            'direct',
            'shuiqing_queue2',
            routing_key='shuiqing_key2'
        )

    def on_message(self, chan, method_frame, header_frame, body, userdata=None):
        """运行订阅任务"""
        print(body)

if __name__ == "__main__":
    sub = Test()
    sub.start()


